package com.zxy.ziems.server.energy.mapper;

import com.zxy.ziems.server.energy.pojo.dto.DeviceMeasureDataDayDTO;
import com.zxy.ziems.server.energy.pojo.entity.DeviceMeasureDataHistoryEntity;
import com.zxy.ziems.server.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface DeviceMeasureDataHistoryMapper extends BaseMapperX<DeviceMeasureDataHistoryEntity> {

    /**
     * 获取天统计
     * @param startTime
     * @param endTime
     * @return
     */
    List<DeviceMeasureDataDayDTO> getHistoryDayStatistics(@Param("startTime") LocalDateTime startTime, @Param("endTime")LocalDateTime endTime);

    /**
     * 批量删除
     * @param deviceIds
     * @param date
     */
    void batchDeleteByIdDate(List<String> deviceIds, String date);


    /**
     * 批量保存列表（相同时间相同设备相同属性会覆盖更新）
     * @param list
     */
    void batchSaveEntityList(List<DeviceMeasureDataHistoryEntity> list);

    /**
     * 批量查询设备的小时第一个数据
     * @param deviceIdList
     * @param startTime
     * @param endTime
     * @return
     */
    List<DeviceMeasureDataHistoryEntity> selectHourDataFirst(List<String> deviceIdList, LocalDateTime startTime, LocalDateTime endTime);
}
